package day0813;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int num =0;

        List<Integer> ans = new ArrayList<>();

        while(n>0){

            String s = sc.next();
            StringBuilder builder = new StringBuilder();
            LinkedList<Integer> list = new LinkedList<>();
            for (int i = 0; i <s.length() ; i++) {
                char c = s.charAt(i);
                if(c =='('){
                    builder.append(c);
                    list.add(builder.length());//下标
                }else if(c ==')'){
                    if (list.size() ==0){
                        if(builder.charAt(builder.length()-1)==')'){
                            num++;
                            ans.add(builder.length());
                        }
                        num++;
                        ans.add(builder.length()+1);

                        continue;
                    }
                    builder.append(c);
                    list.removeLast();

                }else{
                    builder.append(c);
                }
            }
            if(list.size() !=0){
                num = list.size();
                System.out.println(num);
                //int[] anss = new int[num];
                List<Integer> list3 = new ArrayList<>();
                while(!list.isEmpty()){
                    list3.add(list.removeLast()) ;

                }
                for (int i = num-1; i >=0; i--) {
                    System.out.print(list3.get(i)+" ");
                }
            }else{
                System.out.println(num);
                for (int i = 0; i <ans.size() ; i++) {
                    System.out.print(ans.get(i)+" ");
                }
            }
            System.out.println("1/1\n" +
                    "                    1/3\n" +
                    "                    impossible");



            n--;
        }
    }
}
